package com.javase.Homework;

public class Homework01 {
    public static void main(String[] args) {
        Number max = 0;
        double[] a = {3.3,6.6,99.9,13.2};
        A01 a01 = new A01();
        max = a01.max(a);
        if (a != null) {
            System.out.println("a的最大值是"+max);
        }else {
            System.out.println("a数组错误");
        }
    }
}

class A01{
    public Number max(double[] a){
        //考虑代码健壮性添加判断
        if (a != null && a.length > 0) {
            double max = a[0];
            for (int i = 1 ; i < a.length ; i++) {
                if (a[i] > max) {
                    max = a[i];
                }
            }
            return max;
        }else {
            return null;
        }
    }
}